<!DOCTYPE html>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<html>
<head>
<title>${name_china}管理列表</title>
<%@include file="/common/headmy.jsp" %>

<!-- 时间日期插件 -->
<link href="<%=request.getContextPath()%>/static/plugin/My97DatePicker/skin/default/datepicker.css" rel="stylesheet" >
<script src="<%=request.getContextPath()%>/static/plugin/My97DatePicker/WdatePicker.js"></script>

</head>
<body class="iframe-page">
<div class="page-title-wrapper">
    <div class="page-title">
        <div class="page-title-text">
            <span>${name_china}管理</span>
        </div>
        <div id="toolbar" style="float: right"></div>
    </div>
    <div class="page-title-border"></div>
</div>


<div id="t-wrap">
    <table class="summer-datagrid" id="dataList">
	    <col width="10%">
	    <col width="15%">
	    <col width="20%">
	    <col width="20%">
	    <col width="20%">
	    <col width="15%">
	    <thead>
		    <tr>
		        <th>序列</th>
		        <th>类型</th>
		        <th>一级分销（百分比）</th>
		        <th>二级分销（百分比）</th>
				<th>三级分销（百分比）</th>
				<th>操作</th>
		    </tr>
	    </thead>
    </table>
</div>

<script>
	//请求url
	var CONST_URL = {
		LIST: basePath + '${common_url}list',
	   	INIT_EDIT: basePath + "${common_url}initEdit",
	};
	
    var  permission = CommonUtil.getPermission('${name_english}');
    	
        
        
        createTable();
        
        //编辑
        $('#t-wrap').on('click', 'a[data-permit="${name_english}:initEdit"]', function() {
            var $this = $(this),
                id = $this.closest('tr').find('td[data-field="id"]').attr('data-value');
            window.location.href = CONST_URL.INIT_EDIT + '?id=' + id;
        });	
        
    
    // 重新加载表格
	function reloadTable() {
    	//alert($('#category').combobox('getValue'));
    	//alert(trimSpace($('#name').val()));
		$('#dataList').datagrid('reload',{
            ajax: {
            	param: {
            		"account": trimSpace($('#name').val()),
            		"category":$('#category').combobox('getValue')
                	//"startTime": trimSpace($('#startTime').val()),
                	//"stopTime": trimSpace($('#stopTime').val())
            	}
            }
        });
	}
    
    //创建表格
    function createTable() {
    	$('#dataList').datagrid({
    		ajax: {
    			url: CONST_URL.LIST,
    			param: {
            	}
    		},
    		columns: [
    		     {
    		    	 field: 'id',
    		    	 //hidden: true
    		     },
    		     {
    		    	 field: 'cateName'
    		     },
    		     {
    		    	 field: 'oneLevelCate',
    		     },
    		     {
    		    	 field: 'twoLevelCate'
    		     },
    		     {
    		    	 field: 'thirdLevelCate'
    		     },
    		    {
    		    	 render: function (rowData) {
    		    		 return $.funcbar({
    		    			 data: permission,    //请求的数据
    		    			 type: 'text',     //类型
    		    			 display: 1,    //显示数量
    		    			 permit: ['${name_english}:initEdit'] //需要的权限按钮
    		    		 });
    		    	 }
    		    }
    		          
    	    ]
    	});
    }
    
    
   
   
</script>
</body>
</html>